package dome6Test;
import dome3Set.SetDome2Student;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class test {
    private List<place> list1 = new ArrayList<>();

    public static void main(String[] args) {
        String[] placename = {"野外拓展", "农家乐", "轰趴", "", "健身房", ""};
        String[] placename2 = {"野外拓展", "农家乐", "轰趴", "", "健身房", ""};
        String[] placename3 = {"野外拓展", "农家乐", "轰趴", "", "健身房", ""};
        String[] names = {"陈世玉", "小敏", "小美", "小明"};
        Map<String, place> map = new HashMap<>();
        for (String name : names) {
            Random random = new Random();
            List<String> name1 = new ArrayList<>();
            name1.add(placename[random.nextInt(placename.length)]);
            name1.add(placename[random.nextInt(placename2.length)]);
            name1.add(placename[random.nextInt(placename3.length)]);
//            name1.add(placename[random.nextInt(placename.length)]);
            int num = name1.size();
            for (int i = 0; i < name1.size(); i++) {
                if (name1.get(i).equals("")) {
                    num--;
                }
            }
            map.put(name, new place(name1, num));
        }
//        System.out.println(map);
        for (Map.Entry<String, place> stringplaceEntry : map.entrySet()) {
            String key = stringplaceEntry.getKey();
            place value = stringplaceEntry.getValue();
            System.out.println(key+"的选择是"+value);

        }
//        Stream<Map.Entry<String,Integer>> s1=map.entrySet().stream();
        Stream<Map.Entry<String, place>> s2 = map.entrySet().stream().filter(e->e.getValue().getNum()==0);
        Stream<Map.Entry<String, place>> s3= map.entrySet().stream().filter(e->e.getValue().getNum()==3);
//        System.out.println(s2);
        List<Map.Entry<String, place>> collect = s2.collect(Collectors.toList());
        List<Map.Entry<String, place>> collect1 = s3.collect(Collectors.toList());
        for (Map.Entry<String, place> stringplaceEntry : collect) {
            String key = stringplaceEntry.getKey();
//            place value = stringplaceEntry.getValue();
            System.out.println(key+"没有选择");
        } for (Map.Entry<String, place> stringplaceEntry : collect1) {
            String key = stringplaceEntry.getKey();
//            place value = stringplaceEntry.getValue();
            System.out.println(key+"最多选择");
        }

    }

//    public boolean equals(Object o) {
//        //1.如果直接比较地址，就认为两个对象是同一个对象
//        if (this == o)
//            return true;
//        //2.判断是否为空，并且判断是否为同一个对象
//        if (o == null || getClass() != o.getClass())
//            return false;
//        //3.比较两个对象的属性值是否相同
////        SetDome2Student that = (SetDome2Student) o;
////        return age == that.age && Objects.equals(name, that.name) && Objects.equals(address, that.address);
//    }
}
